<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<<<<<<< HEAD
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="renderer" content="webkit">
		 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="layui/css/layui.css"  media="all">
		
	</head>
	<body>
				
		<form class="layui-form" action="">
		
		  <div class="layui-form-item">
		    <label class="layui-form-label">公告号：</label>
		    <div class="layui-input-block">
		      <input type="text" name="title" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">管理员：</label>
		    <div class="layui-input-block">
		      <select name="city" lay-verify="required">
		        <option value=""></option>
		        <option value="0">一号</option>
		        <option value="1">二号</option>
		        <option value="2">三号</option>
		      </select>
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">发布状态：</label>
		    <div class="layui-input-block">
		      <input type="radio" name="tstatus" value="已发布" title="已发布">
		      <input type="radio" name="tstatus" value="未发布" title="未发布" checked>
		    </div>
		  </div>
		  
		  <div class="layui-form-item layui-form-text">
		    <label class="layui-form-label">发布内容：</label>
		    <div class="layui-input-block">
		      <textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <div class="layui-input-block">
		      <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
		      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
		    </div>
		  </div>
		</form>
		 
		 <script src="${pageContext.request.contextPath}/js/jquery-2.0.3.js"></script>

		<!--分页操作 2- 引入layui.js文件 -->
		<script src="layui/layui.js" charset="utf-8"></script>
		<script>
		//Demo
		layui.use('form', function(){
		  var form = layui.form;
		  
		  //监听提交
		  form.on('submit(formDemo)', function(data){
		    layer.msg(JSON.stringify(data.field));
		    return false;
		  });
		});
		</script>
		
		    
=======
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>

<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="renderer" content="webkit">
		 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="layui/css/layui.css"  media="all">
		
	</head>
	<body>
		
			
		<form class="layui-form" action="">
		  <div class="layui-form-item">
		    <label class="layui-form-label">公告号：</label>
		    <div class="layui-input-block">
		      <input type="text" name="tid" id="tid" disabled="disabled" placeholder=${param.id } value=${param.id } autocomplete="off" class="layui-input">
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">管理员：</label>
		    <div class="layui-input-block">
		      <select name="city" id="ano" lay-verify="required">
		        <option value=""></option>
		        <option value="101">一号</option>
		        <option value="1">二号</option>
		        <option value="2">三号</option>
		      </select>
		    </div>
		  </div>
		  
		  <div class="layui-inline">
		      <label class="layui-form-label">发布时间：</label>
		      <div class="layui-input-inline">
		        <input type="text" id="tdate" width="80%">
		      </div>
		    </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">发布状态：</label>
		    <div class="layui-input-block">
		      <input type="radio" name="tstatus" value="已发布" title="已发布" id="已发布">
		      <input type="radio" name="tstatus" value="未发布" title="未发布" id="未发布">
		    </div>
		  </div>
		  
		  <div class="layui-form-item layui-form-text">
		    <label class="layui-form-label">发布内容：</label>
		    <div class="layui-input-block">
		      <textarea name="desc" id="tinfo" placeholder="请输入内容" class="layui-textarea"></textarea>
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <div class="layui-input-block">
		      <button class="layui-btn" lay-submit lay-filter="formDemo" id="submit">立即提交</button>
		      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
		    </div>
		  </div>
		</form>
		 
		 <script src="${pageContext.request.contextPath}/js/jquery-2.0.3.js"></script>

		<!--分页操作 2- 引入layui.js文件 -->
		<script src="layui/layui.js" charset="utf-8"></script>
		
		<script>
		//Demo
		layui.use('form', function(){
		  var form = layui.form;
		  
		  //监听提交
		  form.on('submit(formDemo)', function(data){
		    layer.msg(JSON.stringify(data.field));
		    return false;
		  });
		});
		
		
		layui.use('laydate', function(){
			  var laydate = layui.laydate;
			//日期时间选择器
			laydate.render({ 
			  elem: '#tdate',
			  type: 'datetime',
			  format: 'yyyy年MM月dd日 HH时mm分ss秒'
			});
		});
		</script>
		<script type="text/javascript">
			var tid = $("#tid").val();
				$(function(){
			         $.ajax({
			        	 url:"GongGaoServlet",
			             type: "post",
			             data: {
			            	 tid:tid,
			            	 op:"updateGetOne"
			             },
			             dataType: "json",
			             success: function(res){
			            	 console.log(res);
	                         console.log(res.tstatus);
	                         $("#tdate").val(res.tdate);
	                         $("#ano").val(res.ano);
	                         $("input[type='radio'][name='tstatus'][value="+res.tstatus+"]").attr("checked",true);
	                         $("#tinfo").val(res.tinfo);
	                      }
			         });
				});
				$(function() {
					$("#submit").click(function() {
						$.ajax({
							url:"GongGaoServlet",
							type:"post",
							data:{
								tid:$("#tid").val(),
								ano:$("#ano").val(),
								tdate:$("#tdate").val(),
								tstatus:$('input:radio:checked').val(),
								tinfo:$("#tinfo").val(),
								op:"update"
							},
							daytType:"json",
							success: function(res){
								if(res=="true"){
									console.log("修改成功");
									layer.alert('修改成功', {
										  icon: 1,
										 // skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则，去这里查阅
										  yes: function(layero, index){
												//当你在iframe页面关闭自身时
												var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
												parent.layer.close(index); //再执行关闭   
											  }
										
										});
									
								};
								
							}
						});
						
					});
				});
		</script>
		
>>>>>>> branch 'master' of https://gitee.com/wzx823570766/BeiJing_Project_Level_Two.git
	</body>
</html>
